package com.ybkj.daijia.server.service.impl;

import com.ybkj.daijia.server.mapper.WxBindMapper;
import com.ybkj.daijia.server.model.WxBind;
import com.ybkj.daijia.server.service.WxBindService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class DefaultWxBindService implements WxBindService {

    @Autowired
    private WxBindMapper wxBindMapper;

    @Override
    public WxBind findByPhone(String phone) {

        return wxBindMapper.selectByPhone(phone);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public WxBind insertRecrod(WxBind bind) {

        wxBindMapper.insertRecord(bind);

        return bind;
    }

    @Override
    public WxBind findByWxuser(String fromUser) {

        return wxBindMapper.selectByWxuser(fromUser);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int updateByPrimaryKey(WxBind record) {

        return wxBindMapper.updateByPrimaryKey(record);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteByPrimaryKey(Long id) {

        return wxBindMapper.deleteByPrimaryKey(id);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteByWxuser(String wxuser) {

        return wxBindMapper.deleteByWxuser(wxuser);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteByPhone(String phone) {

        return wxBindMapper.deleteByPhone(phone);
    }

}
